package com.itheima.sh.f_array_06;

public class Demo01 {
    public static void main(String[] args) {
        int[] arr={20,30,40,50};
        int max=arr[0];
        int min=arr[0];
        int sum=0;
        for (int i = 1; i < arr.length; i++) {
            if (arr[i]>max){
                max=arr[i];

            }
            if(arr[i]<min){
                min=arr[i];
            }
        }
        for (int i = 0; i < arr.length; i++) {
            sum+=arr[i];
        }
        System.out.println("最大值为"+max);
        System.out.println("最小值为"+min);
        System.out.println("和值为"+sum);

    }
}
